The evolution of computer hardware and software continues at a rapid pace, with each evolution typically producing new features, better performance or more economic operation. For example, over time processor architectures for personal computers have become faster, and have evolved from eight bit, to sixteen bit, to thirty-two bit to the present day sixty-four bit processor architectures.
One design choice in hardware or software architectures is whether the new architecture will support software designed for previous architectures. The choice typically involves a tradeoff between performance and market acceptability. For example, providing support for executing software designed for previous architectures typically increases the complexity of the design and typically results in a decrease in performance when executing software designed for previous architectures. However, not providing such support may cause the new architecture to be less desirable in the marketplace, because there may be vast amounts of previously installed software that may not run on the new architectures. For example, there are vast numbers of computer systems and software that require legacy BIOS (Basic Input Output System), legacy option ROMs, legacy OS (Operating System) loaders, and older operating systems such as DOS, Microsoft Windows® 3.1, Microsoft Windows 95 and Microsoft Windows 98.
One mechanism used in previous systems to provide support for previous architectures is referred to as emulation. In emulation, a processor or processors run in their native mode and interpret the instructions of the previous mode. In previous systems, emulators have been provided as applications running on top of an operating system, or within an operating system itself. This type of emulation is typically not available until the system has been booted. Software executed during the boot process cannot be emulated in these systems.
The above described issues are multiplied in a virtual machine environment. In a virtual machine environment, multiple operating systems may execute on a single hardware system, with each operating system appearing to have full control of the hardware system. Each operating system running in a virtual machine environment is referred to as a “guest” operating system.
In one system designed to support a virtual machine environment with multiple guest operating systems, each time an instruction in a legacy mode is detected, a software emulator executes a single instruction and returns control back to the guest operating system. This incurs the overhead of saving and restoring the entire guest CPU state for each instruction executed. The can result in significant performance penalties.